/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#ifndef _CUBEFS_CORE_MODELS_KVMAP_FACTORY_HPP
#define _CUBEFS_CORE_MODELS_KVMAP_FACTORY_HPP

#include <cubefs/api/types.hpp>

#include <cubefs/core/container/container.hpp>
#include <cubefs/core/btree/btree.hpp>

#include <cubefs/core/models/tree_map/factory.hpp>


#include <cubefs/core/models/kvmap/names.hpp>
#include <cubefs/core/models/kvmap/model/find.hpp>
#include <cubefs/core/models/kvmap/model/model_api.hpp>

#include <cubefs/core/models/kvmap/model/checks.hpp>
#include <cubefs/core/models/kvmap/model/insert.hpp>
#include <cubefs/core/models/kvmap/model/remove.hpp>

namespace cubefs    {
namespace ctr       {

using namespace cubefs::btree;
using namespace cubefs::tools;

CUBEFS_TYPE_FACTORY_BEGIN(RootProfile, KVMap)

    struct ModelTypes: public BTreeTypes<Profile, KVMap, BigInt> {
        typedef BTreeTypes<Profile, KVMap, BigInt> 								Base;

        typedef typename AppendTool<
                    typename Base::ModelPartsList,
                    typename TypeListTool<
                        cubefs::models::kvmap::FindName,
                        cubefs::models::kvmap::ChecksName,
                        cubefs::models::kvmap::InsertName,
                        cubefs::models::kvmap::RemoveName,
                        cubefs::models::kvmap::MapApiName,

                        cubefs::models::tree_map::ApiName,
                        cubefs::models::tree_map::ModelApiName,

                        cubefs::models::map::ApiName,
                        cubefs::models::map::ModelApiName,

                        cubefs::models::collection::ApiName,
                        cubefs::models::collection::ModelApiName,

                        cubefs::models::model::ApiName,
                        cubefs::models::model::ModelApiName
                    >::List
        >::Result                                                               ModelPartsList;
    };

    typedef BTree<ModelTypes>                                                   BTreeType;

public:
    typedef typename TypeLocator<Profile, BTreeType>::Type                      Type;

CUBEFS_TYPE_FACTORY_END



}
}


#endif //_CUBEFS_CORE_MODELS_KVMAP_FACTORY_HPP
